let obj = {
    a: '1',
    b: '2',
    c: {
        d: '3',
        e: {
            f: '4'
        },
        g: {
            h: '5',
            y: '6'
        }
    }
}
const pathCall = (o, path) => {
    let filt = path.split('.').filter(item => item != 'obj')
    return filt.reduce((p, c) => {
        return p ? p[c] : undefined
    }, o)
}

console.log(pathCall(obj, 'obj.y.g.u'))